package io.hepu.robotize.enums;

/**
 * 响应状态
 */
public enum IStatus {

    // --- 2xx Success ---
    SUCCESS     (SC.SUCCESS, "操作成功"),
    CREATED     (SC.CREATED, "创建成功"),
    ACCEPTED    (SC.ACCEPTED, "更新成功"),
    NO_CONTENT  (SC.NO_CONTENT, "内容为空"),

    // --- 4xx Client Error ---
    FAILURE             (SC.FAILURE, "操作失败"),
    UNAUTHORIZED        (SC.UNAUTHORIZED, "身份未验证"),
    FORBIDDEN           (SC.FORBIDDEN, "禁止访问"),
    REQ_NOT_FOUND       (SC.REQ_NOT_FOUND, "资源不存在"),
    REQ_NOT_ALLOWED     (SC.REQ_NOT_ALLOWED, "请求非法"),
    REQ_NOT_ACCEPTABLE  (SC.REQ_NOT_ACCEPTABLE, "无法接受"),
    REQ_TIMEOUT         (SC.REQ_TIMEOUT, "请求超时"),

    // --- 5xx Server Error ---
    INTERNAL_SERVER_ERROR   (SC.INTERNAL_SERVER_ERROR, "服务器内部错误"),
    NOT_IMPLEMENTED         (SC.NOT_IMPLEMENTED, "请求无法满足"),
    BAD_GATEWAY             (SC.BAD_GATEWAY, "网关错误"),
    SERVICE_UNAVAILABLE     (SC.SERVICE_UNAVAILABLE, "服务不可用"),
    GATEWAY_TIMEOUT         (SC.GATEWAY_TIMEOUT, "网关超时"),

    // --- 6xx AUTH Error ---
    ACCOUNT_LOCKED          (SC.ACCOUNT_LOCKED, "账户被锁定"),
    ACCOUNT_INVALID         (SC.ACCOUNT_INVALID, "账号不存在"),
    ACCOUNT_EXPIRED         (SC.ACCOUNT_EXPIRED, "账户已过期"),
    ACCOUNT_DISABLED        (SC.ACCOUNT_DISABLED, "账户被禁用"),
    ACCOUNT_UNREGISTERED    (SC.ACCOUNT_UNREGISTERED, "账户未注册"),
    ACCOUNT_UNAUTHORIZED    (SC.ACCOUNT_UNAUTHORIZED, "账户未授权"),

    AUTHENTICATED_EXPIRED   (SC.AUTHENTICATED_EXPIRED, "身份认证过期"),
    AUTHENTICATED_FAILURE   (SC.AUTHENTICATED_FAILURE, "身份认证失败"),
    AUTHENTICATED_INVALID   (SC.AUTHENTICATED_INVALID, "身份信息无效"),

    AUTHORIZED_DENIED       (SC.AUTHORIZED_DENIED, "账户权限不够"),

    AUTH_MAX_ATTEMPTS       (SC.AUTH_MAX_ATTEMPTS, "尝试次数过多"),
    AUTH_BAD_CREDENTIALS    (SC.AUTH_BAD_CREDENTIALS, "密码不正确"),

    // --- 7xx DB Error ---
    DUPLICATE_KEY           (SC.DUPLICATE_KEY, "主键重复"),
    DB_ACCESS_ERROR         (SC.DB_ACCESS_ERROR, "数据库异常"),


    SYSTEM_ERROR            (SC.SYSTEM_ERROR, "系统异常");

    private final int code;
    private final String message;

    IStatus(int code, String message) {
        this.code = code;
        this.message = message;
    }

    public int code() {
        return this.code;
    }

    public String message() {
        return this.message;
    }
}
